package com.qifan.energy.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qifan.energy.bean.result.CartListResult;
import com.qifan.energy.R;
import com.qifan.energy.global.GlideApp;

import java.util.List;

public class ConfirmOrderAdapter extends BaseQuickAdapter<CartListResult,BaseViewHolder> {

    public ConfirmOrderAdapter(@Nullable List<CartListResult> data) {
        super(R.layout.item_confirm_order, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, CartListResult item) {
        helper.setText(R.id.product_name_tv,item.getProductName());
        ImageView productIv = helper.getView(R.id.product_iv);
        GlideApp.with(helper.itemView)
                .load(item.getProductPic())
                .placeholder(R.mipmap.icon_default_rect)
                .error(R.mipmap.icon_default_rect)
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(productIv);
    }
}
